public class test {
    public static int removeDuplicates(int[] nums) {
        int i = 0;
        int j = 1;
        int len = nums.length;
        if(len < 2){
            return len;
        }
        while(j < len){
            if(nums[i] == nums[j]){
                j++;
            }else{
                i++;
                nums[i] = nums[j];
                j++;
            }
        }
        return i + 1;
    }
    public static void main(String[] args) {
        int[] ints = new int[]{1,2,2,3,3,4,5,5,6,7,7};
        int len = removeDuplicates(ints);
        System.out.println(len);
    }
}
